class BootStrap {

    def init = { servletContext ->
        // Create some test data
        def bill1 = new BillingInfo(insuranceName:"Anthem",groupNumber:"Group111",creditCardNum:"123-456-789",lastUpdated:null).save()
        def bill2 = new BillingInfo(insuranceName:"BlueCross",groupNumber:"Group222",creditCardNum:"999-888-777",lastUpdated:null).save()

        def contact1 = new ContactInfo (streetAddress:"1, Harvey Road", townAddress:"Windsor",zipcode:"06095", email:"contact1@yahoo.com",
            prefEmail:"prefcontact1@yahoo.com",cellPhone:"(766)213-1234",homePhone:"(980)123-2345", workPhone:"(876)123-7666",lastUpdated:new Date()).save()
        def contact2 = new ContactInfo (streetAddress:"2, Harvey Road", townAddress:"South Windsor",zipcode:"12345", email:"contact2@yahoo.com",
            prefEmail:"prefcontact2@yahoo.com",cellPhone:"(766)213-1234",homePhone:"(980)123-2345", workPhone:"(876)123-7666",lastUpdated:new Date()).save()

        def phr1 = new HealthRecord(gender:"Female",height:'4',weight:'125',bloodType:"A-",bloodPressure:"111/71",BMI:"21",procedures:null,lastUpdated:new Date()).save()
        def phr2 = new HealthRecord(gender:"Male",height:'5',weight:'185',bloodType:"B+",bloodPressure:"122/72",BMI:"22",procedures:null,lastUpdated:new Date()).save()

        def pat1 = new Patient(NII:"NII_001",name:"Sick O'Toole", dateOfBirth:new Date("12/12/1978"),contactInfo:contact1, billingInfo:bill1, PHR:phr1).save()
        def pat2 = new Patient(NII:"NII_002",name:"Feeling Better", dateOfBirth:new Date("2/2/1972"),contactInfo:contact2, billingInfo:bill2, PHR:phr2).save()
        def pat3 = new Patient(NII:"NII_003",name:"Count me in three", dateOfBirth:new Date("3/3/1973"),contactInfo:contact2, billingInfo:bill2, PHR:phr2).save()

    //   new MedProcedure(name:"Amputation",datePerformed:new Date(), notes:"it hurts").save()
     //   new MedProcedure(name:"Biopsy",datePerformed:new Date(), notes:"what have we got here?").save()

        def doc1 = new Doctor (patient:pat1, NPI:"NPI_111",name:"Doctor Dooalot1", location:"Hartford", latLong:'1L', specialty:"Dermatology").save()
        def doc2 =  new Doctor (patient:pat1, NPI:"NPI_222",name:"Doctor Doolittle2", location:"Simsbury", latLong:'22L', specialty:"Cardiology").save()
        def doc3 = new Doctor ( patient:pat1,NPI:"NPI_333",name:"Doctor Doonothing3", location:"Windsor", latLong:'33L', specialty:"Plastic Surgery").save()


        new Appointment(reason:"sick visit",status:"booked", patient:pat1, doctor:doc1, location:"Windsor", startTime: new Date(), duration:'1', reminderDate:new Date(), notes:"bootstrap data").save()
        new Appointment(reason:"follow-up",status:"cancelled", patient:pat2, doctor:doc2, location:"Simsbury", startTime: new Date(), duration:'2', reminderDate:new Date(), notes:"second appointment").save()
      
    }

     def destroy = {
     }
} 